﻿using Unity.VisualScripting;
using UnityEngine;

namespace Gameplay.CharacterFramework
{
    [CreateAssetMenu(fileName = "NewThrow", menuName = "Skills/NewThrow")]
    public class Throw : Skill
    {

        public float Speed;
        public GameObject Projectile;
        public override void Use(Role user)
        {
            base.Use(user);
            user.transform.LookAt(_target.transform);
        }

        public override void Finish()
        {
            base.Finish();
            var projectile=new ProjectileEmitter(_user, Projectile);
            Vector3 direction =_target.transform.position-_user.transform.position;
            projectile.Shoot(CurrentWeapon.transform.position,Quaternion.identity,direction,Speed);
           
        }
    }
}
